home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 1998 November / IRIX 6.5.2 Base Documentation November 1998.img / usr / share / catman / p_man / cat3 / daemonize.z / daemonize
Text File  |  1998-10-20  |  3KB  |  67 lines

  1.  
  2.  
  3.  
  4. DDDDAAAAEEEEMMMMOOOONNNNIIIIZZZZEEEE((((3333))))                                                      DDDDAAAAEEEEMMMMOOOONNNNIIIIZZZZEEEE((((3333))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      _daemonize - make a process into a daemon
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ####iiiinnnncccclllluuuuddddeeee <<<<uuuunnnniiiissssttttdddd....hhhh>>>>
  13.  
  14.      iiiinnnntttt ____ddddaaaaeeeemmmmoooonnnniiiizzzzeeee((((iiiinnnntttt ffffllllaaaaggggssss,,,, iiiinnnntttt ffffdddd1111,,,, iiiinnnntttt ffffdddd2222,,,, iiiinnnntttt ffffdddd3333))));;;;
  15.  
  16. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  17.      The __d_a_e_m_o_n_i_z_e function does the common work needed ``to put a function
  18.      into the background,'' or to make it into a ``daemon.''  That generally
  19.      includes forking a new process, closing most files, and releasing the
  20.      controlling tty.
  21.  
  22.      If ffffllllaaaaggggssss &&&& ____DDDDFFFF____NNNNOOOOFFFFOOOORRRRKKKK is 0, then a new process in a new session is
  23.      started.  Debugging is often easier with ffffllllaaaaggggssss set to contain ____DDDDFFFF____NNNNOOOOFFFFOOOORRRRKKKK.
  24.  
  25.      If ffffllllaaaaggggssss &&&& ____DDDDFFFF____NNNNOOOOCCCCHHHHDDDDIIIIRRRR is 0, then the current working directory is
  26.      changed to /.  Otherwise, the current working directory is unchanged.
  27.  
  28.      If ffffllllaaaaggggssss &&&& ____DDDDFFFF____NNNNOOOOCCCCLLLLOOOOSSSSEEEE is 0, then all file descriptors except ffffdddd1111, ffffdddd2222,
  29.      and ffffdddd3333 are closed.  Because __d_a_e_m_o_n_i_z_e closes all file descriptors,
  30.      _c_l_o_s_e_l_o_g() is called to stop logging cleanly.  The ffffdddd# arguments should
  31.      be -1 if they are not file descriptors to be left open.
  32.  
  33. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  34.      close(2), chdir(2), fork(2), getdtablesize(2), syslog(3B), setsid(2),
  35.      tty(1), tty(7)
  36.  
  37. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  38.      The returned value -1 indicates that one of the necessary system calls
  39.      failed.
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.